package com.netkiller.mailmonitor.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.netkiller.mailmonitor.dao.BlobHistoryDao;
import com.netkiller.mailmonitor.entity.BlobHistory;

/**
 * Service for blob history
 * @author JKB
 *
 */
@Service
public class BlobHistoryService {
	
	@Autowired BlobHistoryDao blobHistoryDao;;
	
	/**
	 * fetch all
	 * @return
	 */
	public List<BlobHistory> getAll(){
		return blobHistoryDao.getAll();
	}
	
	/**
	 * fetch latest 10 entries
	 * @return
	 */
	public List<BlobHistory> getLastTenUploads(){
		return blobHistoryDao.getLastTenUploads();
	}
	
	/**
	 * save to db
	 * @param blobHistory
	 * @return
	 */
	public BlobHistory save(BlobHistory blobHistory){
		return blobHistoryDao.create(blobHistory);
	}

}
